import request from "@/utils/request";

// 获取商品分类结构树
export function getCategoryTreeList() {
  return request({
    url: "/product-category/tree",
    method: "get",
  });
}

// 添加商品分类
export function addCategory(data) {
  return request({
    url: "/product-category",
    method: "post",
    data,
  });
}

// 修改商品分类
export function updateCategory(data) {
  return request({
    url: "/product-category",
    method: "put",
    data,
  });
}

// 删除商品分类
export function deleteCategory(id) {
  return request({
    url: `/product-category/${id}`,
    method: "delete",
  });
}

// 启用/禁用商品分类
export function enableCategory(id, status) {
  return request({
    url: `/product-category/${id}/status/${status}`,
    method: "put",
  });
}
